define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        //用户信息列表
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'qzuser/index',
                    add_url: 'qzuser/add',
                    edit_url: 'qzuser/edit',
                    del_url: 'qzuser/del',
                    multi_url: 'qzuser/multi',
                    table: 'qzuser',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: '',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'userid', title: __('用户ID'), sortable: true},
                        {field: 'img', title: __('头像'), formatter: Table.api.formatter.image, operate: false},
                        {field: 'nickname', title: __('昵称'),operate: 'LIKE'},
                        {field: 'province'+'-'+'city'+'-'+'area', title: __('地区')},
                        {field: 'sex', title: __('性别'), visible: false, searchList: {0: __('未知'), 1: __('男'),2:__('女')}},
                        {field: 'age', title: __('年龄'),operate: 'BETWEEN', sortable: true},
                        {field: 'height'+'/'+'weight', title: __('身高/体重')},
                        {field: 'phone', title: __('手机号')},
                        {field: 'use_type', title: __('用户身份'), visible: false, searchList: {1: __('普通'), 2: __('达人'),3:__('商家')}},
                        {field: 'prased', title: __('获赞量')},
                        {field: 'card_num', title: __('体验卡数量')},
                        {field: 'creat_time', title: __('创建时间'),formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                        // {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
                        // {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                        // {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
                        // {field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                        // {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
                        // {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
                        // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },

        //达人身份认证
        userrz: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'qzuser/userrz',
                    add_url: 'qzuser/add',
                    edit_url: 'qzuser/edit',
                    del_url: 'qzuser/del',
                    multi_url: 'qzuser/multi',
                    table: 'qzuser',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: '',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'userid', title: __('用户ID'), sortable: true},
                        {field: 'img', title: __('头像'), formatter: Table.api.formatter.image, operate: false},
                        {field: 'nickname', title: __('昵称'),operate: 'LIKE'},
                        {field: 'province'+'-'+'city'+'-'+'area', title: __('地区')},
                        {field: 'sex', title: __('性别'), visible: false, searchList: {0: __('未知'), 1: __('男'),2:__('女')}},
                        {field: 'age', title: __('年龄'),operate: 'BETWEEN', sortable: true},
                        {field: 'height'+'/'+'weight', title: __('身高/体重')},
                        {field: 'phone', title: __('手机号')},
                        {field: 'use_type', title: __('用户身份'), visible: false, searchList: {1: __('普通'), 2: __('达人'),3:__('商家')}},
                        {field: 'prased', title: __('获赞量')},
                        {field: 'card_num', title: __('体验卡数量')},

                        {field: 'positive_id_card_img', title: __('身份证正面'), formatter: Table.api.formatter.image, operate: false},
                        {field: 'back_id_card_img', title: __('身份证反面图片'), formatter: Table.api.formatter.image, operate: false},
                        {field: 'hold_id_card_img', title: __('手持身份证照片'), formatter: Table.api.formatter.image, operate: false},


                        {field: 'creat_time', title: __('创建时间'),formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                        // {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
                        // {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                        // {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
                        // {field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                        // {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
                        // {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
                        // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        //商家身份认证
        buyrz: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'qzuser/buyrz',
                    add_url: 'qzuser/add',
                    edit_url: 'qzuser/edit',
                    del_url: 'qzuser/del',
                    multi_url: 'qzuser/multi',
                    table: 'qzuser',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: '',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'userid', title: __('用户ID'), sortable: true},
                        {field: 'img', title: __('头像'), formatter: Table.api.formatter.image, operate: false},
                        {field: 'nickname', title: __('昵称'),operate: 'LIKE'},
                        {field: 'province'+'-'+'city'+'-'+'area', title: __('地区')},
                        {field: 'sex', title: __('性别'), visible: false, searchList: {0: __('未知'), 1: __('男'),2:__('女')}},
                        {field: 'age', title: __('年龄'),operate: 'BETWEEN', sortable: true},
                        {field: 'height'+'/'+'weight', title: __('身高/体重')},
                        {field: 'phone', title: __('手机号')},
                        {field: 'use_type', title: __('用户身份'), visible: false, searchList: {1: __('普通'), 2: __('达人'),3:__('商家')}},
                        {field: 'prased', title: __('获赞量')},
                        {field: 'card_num', title: __('体验卡数量')},

                        {field: 'positive_id_card_img', title: __('身份证正面图片'), formatter: Table.api.formatter.image, operate: false},
                        {field: 'back_id_card_img', title: __('身份证反面图片'), formatter: Table.api.formatter.image, operate: false},
                        {field: 'business_license_img', title: __('营业执照图片'), formatter: Table.api.formatter.image, operate: false},
                        {field: 'other_img', title: __('其他平台注册截图'), formatter: Table.api.formatter.image, operate: false},
                        {field: 'head_of_enterprise', title: __('企业负责人')},
                        {field: 'head_phone', title: __('负责人电话')},
                        {field: 'adress', title: __('详细地址')},



                        {field: 'creat_time', title: __('创建时间'),formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                        // {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
                        // {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                        // {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
                        // {field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                        // {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
                        // {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
                        // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});